package org.study.minio.boot.init;

import lombok.RequiredArgsConstructor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import org.study.minio.boot.config.MinioConstant;
import org.study.minio.boot.util.MinioUtils;

/**
 * 作用描述
 *
 * @author doveylovey
 * @version v1.0.0
 * @email 1135782208@qq.com
 * @date 2023年10月07日
 */
@RequiredArgsConstructor
@Component
public class MinioCommandLineRunner implements CommandLineRunner {
    @Override
    public void run(String... args) throws Exception {
        MinioUtils.createBucket(MinioConstant.BUCKET_DEFAULT);
        MinioUtils.setBucketPublicPolicy(MinioConstant.BUCKET_DEFAULT);

        MinioUtils.createBucket(MinioConstant.BUCKET_TEST);
        MinioUtils.setBucketPublicPolicy(MinioConstant.BUCKET_TEST);
    }
}
